﻿using System;
using OpenGado.DATA.Entities;
using OpenGado.DATA;


namespace OpenGado.Business
{
    /// <summary>
    /// Handles ordering business logic
    /// </summary>
    public class OrdersBusiness
    {

        
        public String GenOrderNumber(Project project, PurchaseOrders order)
        {
            String orderNumber = String.Empty;
            if (project != null)
            {
                orderNumber = project.Code + "-" + order.PurchaseOrderId;
            }
            return orderNumber;
        }
        /// <summary>
        /// Generates the purchase order number from project code
        /// </summary>
        /// <param name="projectCode"></param>
        /// <returns></returns>
        public string GenOrderNumber (String projectCode)
        {
            String purchaseOrderNumber = String.Empty;

            int nextId = PurchaseOrderDataControl.Instance.GetNextId();

            purchaseOrderNumber = projectCode + nextId.ToString();

            return purchaseOrderNumber;
        }
    }
}
